/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ComExWeb.dominio;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.validation.constraints.Size;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author 
 */
@Entity
@Table(schema = "desenv", name = "COMPRA")
@NamedQueries({
    @NamedQuery(name = "Compra.findAll", query = "SELECT c FROM Compra c")})
public class Compra implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_Compra")
    //@GeneratedValue(generator = "seq")
    //@SequenceGenerator(name = "seq", sequenceName = "SEQ1", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long idCompra;

    @Column(name = "DESCRICAO")
    private String descricao;

    @JoinColumn(name = "PESSOA", referencedColumnName = "ID_PESSOA")
    @ManyToOne(optional = false)
    private Pessoa pessoaCompra;

    @Column(name = "DT_COMPRA")
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dtCompra;



    public Compra() {
    }

 
    private static final Logger log = LoggerFactory.getLogger(Compra.class);

    public void setIdCompra(Long idCompra) {

        this.idCompra = idCompra;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    
    public Pessoa getPessoaCompra() {
        return pessoaCompra;
    }

    public void setPessoaCompra(Pessoa pessoaCompra) {
        this.pessoaCompra = pessoaCompra;
    }

    public Date getDtCompra() {
        return dtCompra;
    }

    public void setDtCompra(Date dtCompra) {
        this.dtCompra = dtCompra;
    }


    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCompra != null ? idCompra.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Compra)) {
            return false;
        }
        Compra other = (Compra) object;
        if ((this.idCompra == null && other.idCompra != null) || (this.idCompra != null && !this.idCompra.equals(other.idCompra))) {
            return false;
        }
        return true;
    }
}
